package com.x.service.entity.map;

import com.x.service.entity.CatsList;
import com.x.zssqservice.bean.CategoryList;

import java.util.ArrayList;

/**
 * Created by H on 18/5/9.
 */

public class CategoryListToCatsList implements IMap<CategoryList, CatsList> {
    @Override
    public CatsList map(CategoryList categoryList) {
        CatsList catsList = new CatsList();
        catsList.cats = new ArrayList<>();
        catsList.ok = categoryList.ok;
        for (CategoryList.MaleBean maleBean : categoryList.male) {
            CatsList.Cat cat = new CatsList.Cat();
            cat.bookCount = maleBean.bookCount;
            cat.name = maleBean.name;
            catsList.cats.add(cat);
        }

        for (CategoryList.MaleBean maleBean : categoryList.female) {
            CatsList.Cat cat = new CatsList.Cat();
            cat.bookCount = maleBean.bookCount;
            cat.name = maleBean.name;
            catsList.cats.add(cat);
        }
        return catsList;
    }
}
